package com.cuijq.ms.chain.v3;

import java.util.ArrayList;
import java.util.List;

/**
 * @author by CuiJQ
 * @Classname DemoMain
 * @Description DemoMain Description
 * @Date 2021/7/13 19:38
 */
public class DemoMain {

  public static void main(String[] args) {
    //组装责任链
    List<Handler> handlers = new ArrayList<>();
    Handler handler1 = new ConcreteHandler1();
    Handler handler2 = new ConcreteHandler2();
    Handler handler3 = new ConcreteHandler3();
    handlers.add(handler1);
    handlers.add(handler2);
    handlers.add(handler3);
    for (int i=0;i<handlers.size();i++){
      Handler cur = handlers.get(i);
      cur.handleRequest(cur);
    }
  }
}
